package model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@JsonIgnoreProperties({ "accessUsers" })
public class PersistentEntity implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 7929367284464740214L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;

	@Temporal(TemporalType.TIMESTAMP)
	private Date publisherDate;

	private AccessType accesstyp = AccessType.PUBLIC;
	
	//Only required for restrictedAccess
	@OneToMany
	private List<User> accessUsers;
	
	
	public PersistentEntity() {
	}

	public List<User> getAccessUsers() {
		return accessUsers;
	}

	public void setAccessUsers(List<User> accessUsers) {
		this.accessUsers = accessUsers;
	}

	public AccessType getAccesstyp() {
		return accesstyp;
	}

	public void setAccesstyp(AccessType accesstyp) {
		this.accesstyp = accesstyp;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Date getPublisherDate() {
		return publisherDate;
	}

	public void setPublisherDate(Date publisherDate) {
		this.publisherDate = publisherDate;
	}

}
